package net.xiduth.game.player.dialogues;

import net.xiduth.Settings;
import net.xiduth.game.player.content.PlayerLook;

/**
 * 
 * @author Jordan (Plato)
 * 
 */

public class NewPlayerTutorial extends Dialogue {

	/**
	 * Starts The Tutorial.
	 */

	@Override
	public void start() {
		player.lock();
		player.getPackets().sendConfig(1021, 2); // Flashing Icon
		player.getInterfaceManager().closeCombatStyles(); // Disables Combat Tab
		player.getInterfaceManager().closeSkills(); // Disables Skills Tab
		player.getInterfaceManager().closeQuest(); // Disables Quest Tab
		player.getInterfaceManager().closeInventory(); // Disables Inventory Tab
		player.getInterfaceManager().closeEquipment(); // Disables Equipment Tab
		player.getInterfaceManager().closePrayerBook(); // Disables Prayer Tab
		player.getInterfaceManager().closeMagicBook(); // Disables Magic Tab
		player.getInterfaceManager().closeEmotes(); // Disables Emotes Tab
		player.getInterfaceManager().closeSqueal(); // Disables Squeal Tab
		player.getInterfaceManager().closeSettings(); // Disables Settings Tab
		stage = 1;
		sendDialogue(Settings.SERVER_NAME + " Guide", "Welcome to "
				+ Settings.SERVER_NAME + ", " + player.getDisplayName() + ".",
				"Please click the flashing tab, then click continue.");
		stage = 2;
	}

	/**
	 * Second Stage of Tutorial.
	 */

	@Override
	public void run(int interfaceId, int componentId) {
		if (stage == 2) {
			player.getPackets().sendConfig(1021, 0);
			sendDialogue("This is the Player Support Tab.",
					"Here, you can send help tickets, report bugs",
					"and change item looks using this tab.");
			stage = 3;
		}

		/**
		 * Third Stage of Tutorial.
		 */

		else if (stage == 3) {
			sendDialogue(
					"Use any of these available options to your advantage",
					"when in need of help or to improve game experience.");
			stage = 4;
		}

		/**
		 * Fourth Stage of Tutorial.
		 */

		else if (stage == 4) {
			player.getHintIconsManager().addHintIcon(3613, 3373, 0, 100, 0, 0,
					-1, false);
			sendDialogue("Now, please turn the world using your arrow keys",
					"toward the flashing arrow. This is where the bank",
					"is located. Use the bank to store items that you gather.");
			stage = 5;
		}

		/**
		 * The Sixth Stage of Tutorial.
		 */

		else if (stage == 5) {
			player.getHintIconsManager().removeUnsavedHintIcon();
			sendDialogue(
					"Before you set off on your journey, you must be informed",
					"of a few things about Envious.");
			stage = 6;
		}

		/**
		 * The Seventh Stage of Tutorial
		 */

		else if (stage == 6) {
			sendDialogue(
					"Envious is a pk/economy server. This means that you will have",
					"the ability to spawn items. To spawn items do as such ::item (item id) (amount)",
					"so for coins it would look like ::item 995 1000. Also, remember that there",
					"will be restrictions to what items you can spawn.");
			stage = 7;
		}

		else if (stage == 7) {
			player.getHintIconsManager().removeUnsavedHintIcon();
			sendDialogue(
					"Envious wishes the best of luck on your adventure",
					"and hope you are prepared for the world that you have yet",
					"to discover.");
			stage = 8;
		}

		/**
		 * The Tenth Stage of Tutorial.
		 */

		else if (stage == 8) {
			sendDialogue("Thanks for joining Envious.");
			stage = 9;
		}

		/**
		 * The Eleventh Stage of Tutorial.
		 */

		else if (stage == 9) {
			player.getInterfaceManager().sendInterfaces();
			player.closeInterfaces();
			PlayerLook.openThessaliasMakeOver(player);
		}
	}

	@Override
	public void finish() {

	}

}
